<template>
  <div id="morelist">
    <header>
      <div class="close" @click="$router.go(-1)">
        <van-icon name="arrow-left" />
      </div>
      <div class="h_p">
        <p>推荐歌单</p>
      </div>
    </header>
    <ul class="list_box">
      <li v-for="(el, idx) in moreList" :key="idx" @click="pushSongList(el.id)">
        <div class="listimg_box">
          <img :src="el.picUrl" />
          <div class="playCount">
            <div class="playCount_img">
              <img src="../assets/erji.png" />
            </div>
            <div>{{ (el.playCount / 10000).toFixed(1) }}万</div>
          </div>
        </div>
        <div class="list_name">
          {{ el.name }}
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import { get_songlist } from "../api/recommend";
export default {
  data() {
    return {
      moreList: [],
    };
  },
  created() {
    get_songlist().then((res) => {
      this.moreList = res.data.result;
    });
  },
  methods: {
    pushSongList(listId) {
      this.$router.push({
        path: "/songlist",
        query: {
          id: listId,
        },
      });
    },
  },
};
</script>

<style lang="scss" scoped>
#morelist {
  width: 100vw;
  height: 100vh;
  header {
    width: 100%;
    height: 100px;
    background-color: rgb(87, 84, 84);
    position: relative;
    .close {
      position: absolute;
      top: 10px;
      left: 5px;
      i {
        font-size: 30px;
        color: white;
        font-weight: bold;
      }
    }
    .h_p {
      position: absolute;
      left: 50%;
      top: 5%;
      transform: translateX(-50%);
      p {
        font-size: 30px;
        color: white;
        font-weight: bold;
      }
    }
  }
  .list_box {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 0;
    li {
      display: inline-block;
      width: 30%;
      height: 30%;
      margin-right: 10px;
      overflow: hidden;
      white-space: pre-wrap;
      vertical-align: top;
      .listimg_box {
        position: relative;
        img {
          width: 100%;
          height: 100%;
        }
        .playCount {
          position: absolute;
          top: 0;
          right: 5px;
          display: flex;
          color: white;
          font-size: 12px;
          .playCount_img {
            width: 12px;
            height: 12px;
            padding: 1px 5px 0;
            vertical-align: baseline;
          }
          img {
            width: 100%;
            height: 100%;
          }
        }
      }
      .list_name {
        width: 100%;
        font-size: 13px;
      }
    }
  }
}
</style>
